#include <stdio.h>
#define SIZE 10

int arr[SIZE],head=0,tail=0;

void menu()
{
	printf("1.EnQueue\t2.DeQueue\n");
	printf("3.Head\t4.Exit\n");
	printf("Please enter:");
}

void en_queue()
{
	int x;
	if(tail == head) 
	{
		printf("the queue is full!\n");
		return;
	}
	scanf("%d",&x);
	arr[tail] = x;
	if(tail == SIZE - 1)
		tail = 0;
	else
		tail++;
}

void de_queue()
{
	if(head == tail) 
	{
		printf("the queue is empty!\n");
		return;
	}
	printf("%d\n",arr[head]);
	if(head == SIZE - 1)
		head = 0;
	else 
		head++;
}

void head_value()
{
	if(head == tail) 
	{
		printf("the queue is empty!\n");
		return;
	}
	printf("%d\n",arr[head]);
}

int main()
{
	int selection;
	while(1)
	{
		menu();
		scanf("%d",&selection);
		switch(selection)
		{
		case 1:
			en_queue();
			break;
		case 2:
			de_queue();
			break;
		case 3:
			head_value();
			break;
		case 4:
			return 0;
		}
	}
	return 0;
}
